/*
 * Copyright (c) 2022 Huawei Device Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef RENDER_SERVICE_CLIENT_CORE_ANIMATION_RS_MODIFIER_TYPE_H
#define RENDER_SERVICE_CLIENT_CORE_ANIMATION_RS_MODIFIER_TYPE_H

#include <bitset>
#include <cstdint>
#include <map>

namespace OHOS {
namespace Rosen {
// NOTE:
// 1. Following LUTs must be updated according when this enum is updated :
//    a. g_propertyResetterLUT in rs_properties.cpp
//    b. g_propertyToDrawableLut in rs_drawable_content.cpp
// 2. Property modifier(i.e. to be applied to RSProperties) MUST be added before CUSTOM enum, else wise it will not work
enum class RSModifierType : int16_t {
    INVALID = 0,
    BOUNDS,
    FRAME,
    POSITION_Z,
    PIVOT,
    PIVOT_Z,
    QUATERNION,
    ROTATION,
    ROTATION_X,
    ROTATION_Y,
    CAMERA_DISTANCE,
    SCALE,
    SKEW,
    PERSP,
    TRANSLATE,
    TRANSLATE_Z,
    SUBLAYER_TRANSFORM,
    CORNER_RADIUS,
    ALPHA,
    ALPHA_OFFSCREEN,
    FOREGROUND_COLOR,
    BACKGROUND_COLOR,
    BACKGROUND_SHADER,
    BG_IMAGE,
    BG_IMAGE_INNER_RECT,
    BG_IMAGE_WIDTH,
    BG_IMAGE_HEIGHT,
    BG_IMAGE_POSITION_X,
    BG_IMAGE_POSITION_Y,
    SURFACE_BG_COLOR,
    BORDER_COLOR,
    BORDER_WIDTH,
    BORDER_STYLE,
    BORDER_DASH_WIDTH,
    BORDER_DASH_GAP,
    FILTER,
    BACKGROUND_FILTER,
    LINEAR_GRADIENT_BLUR_PARA,
    DYNAMIC_LIGHT_UP_RATE,
    DYNAMIC_LIGHT_UP_DEGREE,
    FG_BRIGHTNESS_RATES,
    FG_BRIGHTNESS_SATURATION,
    FG_BRIGHTNESS_POSCOEFF,
    FG_BRIGHTNESS_NEGCOEFF,
    FG_BRIGHTNESS_FRACTION,
    BG_BRIGHTNESS_RATES,
    BG_BRIGHTNESS_SATURATION,
    BG_BRIGHTNESS_POSCOEFF,
    BG_BRIGHTNESS_NEGCOEFF,
    BG_BRIGHTNESS_FRACTION,
    FRAME_GRAVITY,
    CLIP_RRECT,
    CLIP_BOUNDS,
    CLIP_TO_BOUNDS,
    CLIP_TO_FRAME,
    VISIBLE,
    SHADOW_COLOR,
    SHADOW_OFFSET_X,
    SHADOW_OFFSET_Y,
    SHADOW_ALPHA,
    SHADOW_ELEVATION,
    SHADOW_RADIUS,
    SHADOW_PATH,
    SHADOW_MASK,
    SHADOW_COLOR_STRATEGY,
    MASK,
    SPHERIZE,
    LIGHT_UP_EFFECT,
    PIXEL_STRETCH,
    PIXEL_STRETCH_PERCENT,
    PIXEL_STRETCH_TILE_MODE,
    USE_EFFECT,
    COLOR_BLEND_MODE,
    COLOR_BLEND_APPLY_TYPE,
    SANDBOX,
    GRAY_SCALE,
    BRIGHTNESS,
    CONTRAST,
    SATURATE,
    SEPIA,
    INVERT,
    AIINVERT,
    SYSTEMBAREFFECT,
    WATER_RIPPLE_PROGRESS,
    WATER_RIPPLE_PARAMS,
    HUE_ROTATE,
    COLOR_BLEND,
    PARTICLE,
    SHADOW_IS_FILLED,
    OUTLINE_COLOR,
    OUTLINE_WIDTH,
    OUTLINE_STYLE,
    OUTLINE_DASH_WIDTH,
    OUTLINE_DASH_GAP,
    OUTLINE_RADIUS,
    USE_SHADOW_BATCHING,
    GREY_COEF,
    LIGHT_INTENSITY,
    LIGHT_COLOR,
    LIGHT_POSITION,
    ILLUMINATED_BORDER_WIDTH,
    ILLUMINATED_TYPE,
    BLOOM,
    PARTICLE_EMITTER_UPDATER,
    PARTICLE_NOISE_FIELD,
    FOREGROUND_EFFECT_RADIUS,
    MOTION_BLUR_PARA,
    DYNAMIC_DIM_DEGREE,
    MAGNIFIER_PARA,
    BACKGROUND_BLUR_RADIUS,
    BACKGROUND_BLUR_SATURATION,
    BACKGROUND_BLUR_BRIGHTNESS,
    BACKGROUND_BLUR_MASK_COLOR,
    BACKGROUND_BLUR_COLOR_MODE,
    BACKGROUND_BLUR_RADIUS_X,
    BACKGROUND_BLUR_RADIUS_Y,
    FOREGROUND_BLUR_RADIUS,
    FOREGROUND_BLUR_SATURATION,
    FOREGROUND_BLUR_BRIGHTNESS,
    FOREGROUND_BLUR_MASK_COLOR,
    FOREGROUND_BLUR_COLOR_MODE,
    FOREGROUND_BLUR_RADIUS_X,
    FOREGROUND_BLUR_RADIUS_Y,
    ATTRACTION_FRACTION,
    ATTRACTION_DSTPOINT,
    CUSTOM,
    EXTENDED,
    TRANSITION,
    BACKGROUND_STYLE,
    CONTENT_STYLE,
    FOREGROUND_STYLE,
    OVERLAY_STYLE,
    NODE_MODIFIER,
    ENV_FOREGROUND_COLOR,
    ENV_FOREGROUND_COLOR_STRATEGY,
    GEOMETRYTRANS,
    CHILDREN, // PLACEHOLDER, no such modifier, but we need a dirty flag
    MAX_RS_MODIFIER_TYPE,
};

enum class RSPropertyModifierType : uint8_t {
    GEOMETRY = 0,
    BACKGROUND,
    CONTENT,
    FOREGROUND,
    OVERLAY,
    APPEARANCE,
    CUSTOM,
};

using ModifierDirtyTypes = std::bitset<static_cast<int>(RSModifierType::MAX_RS_MODIFIER_TYPE)>;

enum class RSRenderPropertyType : int16_t {
    INVALID = 0,
    PROPERTY_FLOAT,
    PROPERTY_COLOR,
    PROPERTY_MATRIX3F,
    PROPERTY_QUATERNION,
    PROPERTY_FILTER,
    PROPERTY_VECTOR2F,
    PROPERTY_VECTOR4F,
    PROPERTY_VECTOR4_COLOR,
    PROPERTY_SKMATRIX,
    PROPERTY_RRECT,
};

enum class RSPropertyUnit : int16_t {
    UNKNOWN = 0,
    PIXEL_POSITION,
    PIXEL_SIZE,
    RATIO_SCALE,
    ANGLE_ROTATION,
};

const std::map<RSModifierType, std::string> RS_MODIFIER_TYPE_TO_STRING = {
    { RSModifierType::INVALID, "invalid" },
    { RSModifierType::BOUNDS, "bounds" },
    { RSModifierType::FRAME, "frame" },
    { RSModifierType::POSITION_Z, "position_z" },
    { RSModifierType::PIVOT, "pivot" },
    { RSModifierType::PIVOT_Z, "pivot_z" },
    { RSModifierType::QUATERNION, "quaternion" },
    { RSModifierType::ROTATION, "rotation" },
    { RSModifierType::ROTATION_X, "rotation_x" },
    { RSModifierType::ROTATION_Y, "rotation_y" },
    { RSModifierType::CAMERA_DISTANCE, "camera_distance" },
    { RSModifierType::SCALE, "scale" },
    { RSModifierType::SKEW, "skew" },
    { RSModifierType::PERSP, "persp" },
    { RSModifierType::TRANSLATE, "translate" },
    { RSModifierType::TRANSLATE_Z, "translate_z" },
    { RSModifierType::SUBLAYER_TRANSFORM, "sublayer_transform" },
    { RSModifierType::CORNER_RADIUS, "corner_radius" },
    { RSModifierType::ALPHA, "alpha" },
    { RSModifierType::ALPHA_OFFSCREEN, "alpha_offscreen" },
    { RSModifierType::FOREGROUND_COLOR, "foreground_color" },
    { RSModifierType::BACKGROUND_COLOR, "background_color" },
    { RSModifierType::BACKGROUND_SHADER, "background_shader" },
    { RSModifierType::BG_IMAGE, "bg_image" },
    { RSModifierType::BG_IMAGE_INNER_RECT, "bg_image_inner_rect" },
    { RSModifierType::BG_IMAGE_WIDTH, "bg_image_width" },
    { RSModifierType::BG_IMAGE_HEIGHT, "bg_image_height" },
    { RSModifierType::BG_IMAGE_POSITION_X, "bg_image_position_x" },
    { RSModifierType::BG_IMAGE_POSITION_Y, "bg_image_position_y" },
    { RSModifierType::SURFACE_BG_COLOR, "surface_bg_color" },
    { RSModifierType::BORDER_COLOR, "border_color" },
    { RSModifierType::BORDER_WIDTH, "border_width" },
    { RSModifierType::BORDER_STYLE, "border_style" },
    { RSModifierType::BORDER_DASH_WIDTH, "border_dash_width" },
    { RSModifierType::BORDER_DASH_GAP, "border_dash_gap" },
    { RSModifierType::FILTER, "filter" },
    { RSModifierType::BACKGROUND_FILTER, "background_filter" },
    { RSModifierType::LINEAR_GRADIENT_BLUR_PARA, "linear_gradient_blur_para" },
    { RSModifierType::DYNAMIC_LIGHT_UP_RATE, "dynamic_light_up_rate" },
    { RSModifierType::DYNAMIC_LIGHT_UP_DEGREE, "dynamic_light_up_degree" },
    { RSModifierType::FG_BRIGHTNESS_RATES, "fg_brightness_rates" },
    { RSModifierType::FG_BRIGHTNESS_SATURATION, "fg_brightness_saturation" },
    { RSModifierType::FG_BRIGHTNESS_POSCOEFF, "fg_brightness_poscoeff" },
    { RSModifierType::FG_BRIGHTNESS_NEGCOEFF, "fg_brightness_negcoeff" },
    { RSModifierType::FG_BRIGHTNESS_FRACTION, "fg_brightness_fraction" },
    { RSModifierType::BG_BRIGHTNESS_RATES, "bg_brightness_rates" },
    { RSModifierType::BG_BRIGHTNESS_SATURATION, "bg_brightness_saturation" },
    { RSModifierType::BG_BRIGHTNESS_POSCOEFF, "bg_brightness_poscoeff" },
    { RSModifierType::BG_BRIGHTNESS_NEGCOEFF, "bg_brightness_negcoeff" },
    { RSModifierType::BG_BRIGHTNESS_FRACTION, "bg_brightness_fraction" },
    { RSModifierType::FRAME_GRAVITY, "frame_gravity" },
    { RSModifierType::CLIP_RRECT, "clip_rrect" },
    { RSModifierType::CLIP_BOUNDS, "clip_bounds" },
    { RSModifierType::CLIP_TO_BOUNDS, "clip_to_bounds" },
    { RSModifierType::CLIP_TO_FRAME, "clip_to_frame" },
    { RSModifierType::VISIBLE, "visible" },
    { RSModifierType::SHADOW_COLOR, "shadow_color" },
    { RSModifierType::SHADOW_OFFSET_X, "shadow_offset_x" },
    { RSModifierType::SHADOW_OFFSET_Y, "shadow_offset_y" },
    { RSModifierType::SHADOW_ALPHA, "shadow_alpha" },
    { RSModifierType::SHADOW_ELEVATION, "shadow_elevation" },
    { RSModifierType::SHADOW_RADIUS, "shadow_radius" },
    { RSModifierType::SHADOW_PATH, "shadow_path" },
    { RSModifierType::SHADOW_MASK, "shadow_mask" },
    { RSModifierType::SHADOW_COLOR_STRATEGY, "shadow_color_strategy" },
    { RSModifierType::MASK, "mask" },
    { RSModifierType::SPHERIZE, "spherize" },
    { RSModifierType::LIGHT_UP_EFFECT, "light_up_effect" },
    { RSModifierType::PIXEL_STRETCH, "pixel_stretch" },
    { RSModifierType::PIXEL_STRETCH_PERCENT, "pixel_stretch_percent" },
    { RSModifierType::PIXEL_STRETCH_TILE_MODE, "pixel_stretch_tile_mode" },
    { RSModifierType::USE_EFFECT, "use_effect" },
    { RSModifierType::COLOR_BLEND_MODE, "color_blend_mode" },
    { RSModifierType::COLOR_BLEND_APPLY_TYPE, "color_blend_apply_type" },
    { RSModifierType::SANDBOX, "sandbox" },
    { RSModifierType::GRAY_SCALE, "gray_scale" },
    { RSModifierType::BRIGHTNESS, "brightness" },
    { RSModifierType::CONTRAST, "contrast" },
    { RSModifierType::SATURATE, "saturate" },
    { RSModifierType::SEPIA, "sepia" },
    { RSModifierType::INVERT, "invert" },
    { RSModifierType::AIINVERT, "aiinvert" },
    { RSModifierType::SYSTEMBAREFFECT, "systembareffect" },
    { RSModifierType::HUE_ROTATE, "hue_rotate" },
    { RSModifierType::COLOR_BLEND, "color_blend" },
    { RSModifierType::PARTICLE, "particle" },
    { RSModifierType::SHADOW_IS_FILLED, "shadow_is_filled" },
    { RSModifierType::OUTLINE_COLOR, "outline_color" },
    { RSModifierType::OUTLINE_WIDTH, "outline_width" },
    { RSModifierType::OUTLINE_STYLE, "outline_style" },
    { RSModifierType::OUTLINE_DASH_WIDTH, "outline_dash_width" },
    { RSModifierType::OUTLINE_DASH_GAP, "outline_dash_gap" },
    { RSModifierType::OUTLINE_RADIUS, "outline_radius" },
    { RSModifierType::GREY_COEF, "grey_coef" },
    { RSModifierType::LIGHT_INTENSITY, "light_intensity" },
    { RSModifierType::LIGHT_COLOR, "light_color" },
    { RSModifierType::LIGHT_POSITION, "light_position" },
    { RSModifierType::ILLUMINATED_BORDER_WIDTH, "illuminated_border_width" },
    { RSModifierType::ILLUMINATED_TYPE, "illuminated_type" },
    { RSModifierType::BLOOM, "bloom" },
    { RSModifierType::FOREGROUND_EFFECT_RADIUS, "foreground_effect_radius" },
    { RSModifierType::USE_SHADOW_BATCHING, "use_shadow_batching" },
    { RSModifierType::MOTION_BLUR_PARA, "motion_blur_para" },
    { RSModifierType::PARTICLE_EMITTER_UPDATER, "particle_emitter_updater" },
    { RSModifierType::PARTICLE_NOISE_FIELD, "particle_noise_field" },
    { RSModifierType::DYNAMIC_DIM_DEGREE, "dynamic_dim_degree" },
    { RSModifierType::MAGNIFIER_PARA, "magnifier_para" },
    { RSModifierType::BACKGROUND_BLUR_RADIUS, "background_blur_radius" },
    { RSModifierType::BACKGROUND_BLUR_SATURATION, "background_blur_saturation" },
    { RSModifierType::BACKGROUND_BLUR_BRIGHTNESS, "background_blur_brightness" },
    { RSModifierType::BACKGROUND_BLUR_MASK_COLOR, "background_blur_mask_color" },
    { RSModifierType::BACKGROUND_BLUR_COLOR_MODE, "background_blur_color_mode" },
    { RSModifierType::BACKGROUND_BLUR_RADIUS_X, "background_blur_radius_x" },
    { RSModifierType::BACKGROUND_BLUR_RADIUS_Y, "background_blur_radius_y" },
    { RSModifierType::FOREGROUND_BLUR_RADIUS, "foreground_blur_radius" },
    { RSModifierType::FOREGROUND_BLUR_SATURATION, "foreground_blur_saturation" },
    { RSModifierType::FOREGROUND_BLUR_BRIGHTNESS, "foreground_blur_brightness" },
    { RSModifierType::FOREGROUND_BLUR_MASK_COLOR, "foreground_blur_mask_color" },
    { RSModifierType::FOREGROUND_BLUR_COLOR_MODE, "foreground_blur_color_mode" },
    { RSModifierType::FOREGROUND_BLUR_RADIUS_X, "foreground_blur_radius_x" },
    { RSModifierType::FOREGROUND_BLUR_RADIUS_Y, "foreground_blur_radius_y" },
    { RSModifierType::CUSTOM, "custom" },
    { RSModifierType::EXTENDED, "extended" },
    { RSModifierType::TRANSITION, "transition" },
    { RSModifierType::BACKGROUND_STYLE, "background_style" },
    { RSModifierType::CONTENT_STYLE, "content_style" },
    { RSModifierType::FOREGROUND_STYLE, "foreground_style" },
    { RSModifierType::OVERLAY_STYLE, "overlay_style" },
    { RSModifierType::NODE_MODIFIER, "node_modifier" },
    { RSModifierType::ENV_FOREGROUND_COLOR, "env_foreground_color" },
    { RSModifierType::ENV_FOREGROUND_COLOR_STRATEGY, "env_foreground_color_strategy" },
    { RSModifierType::GEOMETRYTRANS, "geometrytrans" },
    { RSModifierType::CHILDREN, "children" },
    { RSModifierType::MAX_RS_MODIFIER_TYPE, "max_rs_modifier_type" },
};

} // namespace Rosen
} // namespace OHOS

#endif // RENDER_SERVICE_CLIENT_CORE_ANIMATION_RS_MODIFIER_TYPE_H
